package com.itheima.dubbo.service.impl;

import com.itheima.dubbo.HelloFace;
import com.itheima.dubbo.pojo.User;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.rpc.RpcContext;

@DubboService(version = "2.0.0")
public class HelloFaceImpl_V2 implements HelloFace {
    @Override
    public String hello(String name) {
        System.out.println("执行了。。。v2");
//        try {
//            Thread.sleep(2000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

        String jwt = RpcContext.getContext().getAttachment("jwt");
        System.out.println(jwt);

        return "Hello Dubbo name:" + name;
    }

    @Override
    public User findByUsername(String username) {
        User user = new User();
        user.setUsername(username);
        return user;
    }
}
